﻿@using ElectronicsMarket.InternalService
@model ElectronicsMarket.Models.ProductList
           
@{
    ViewBag.Title = "ProductList";
}

@*<h2>Sản phẩm mới</h2>
<div class="product">
    @foreach (var p in Model.NewProductList)
    {
        long prodId = p.Prod.PRODUCT_ID;
	    <div class="item1">
            <div class="name"style="height: 60px;">
			    <h4>@p.Prod.PRODUCT_NAME</h4>
            </div>
		    <div class="itemimage">
                <a href="#">
			        <img src="@Url.Action("GetImage", "Product", new { productId = prodId })" alt="pro1" width="90%"/>
                </a>
                <br />
                <p>@p.Prod.PRODUCT_PRICE</p>
                @using (Html.BeginForm("Detail", "Product", FormMethod.Get))
                {
			        <p>
                        <input type="hidden" name="prodId" value="@prodId"/>
                        <input type="submit" value="Chi tiết" />    
                    </p>
                }
                @using (Html.BeginForm("AddToCart", "Cart"))
                {
                    <input type="hidden" name="productId" value="@p.Prod.PRODUCT_ID"/>
                    <label>Số lượng</label>
                    <input type="text" name="quantity" value="1" style="width: 92px"/>
                    <input type="submit" value="Mua Hàng" />
                }
            </div>
	    </div>
    }
 </div>*@

<h2>Sản phẩm top</h2>
<div class="product">
    @foreach (var p in Model.TopProductList)
    {
        long prodId = p.Prod.PRODUCT_ID;
	    <div class="item1">
            <div class="name" style="height: 60px;">
			    <h4>@p.Prod.PRODUCT_NAME</h4>
            </div>
		    <div class="itemimage">
                <a href="#">
			        <img src="@Url.Action("GetImage", "Product", new { productId = prodId })" alt="pro1" width="90%"/>
                </a>
                <br />
                <p>@p.Prod.PRODUCT_PRICE</p>
			    @using (Html.BeginForm("Detail", "Product", FormMethod.Get))
       {
			        <p>
                        <input type="hidden" name="prodId" value="@prodId"/>
                        <input type="submit" value="Chi tiết" />    
                    </p>
       }
                @using (Html.BeginForm("AddToCart", "Cart"))
                {
                    <input type="hidden" name="productId" value="@p.Prod.PRODUCT_ID"/>
                    <label>Số lượng</label>
                    <input type="text" name="quantity" value="1" style="width: 92px"/>
                    <input type="submit" value="Mua Hàng" />
                }
            </div>
	    </div>
    }
 </div>

<h2>Sản phẩm ngẫu nhiên</h2>
<div class="product">
    @foreach (var p in Model.ProdList)
    {
        long prodId = p.Prod.PRODUCT_ID;
	    <div class="item1">
            <div class="name"style="height: 60px;">
			    <h4>@p.Prod.PRODUCT_NAME</h4>
            </div>
		    <div class="itemimage">
                <a href="#">
			        <img src="@Url.Action("GetImage", "Product", new { productId = prodId })" alt="pro1" width="90%"/>
                </a>
                <br />
                <p>@p.Prod.PRODUCT_PRICE</p>
			    @using (Html.BeginForm("Detail", "Product", FormMethod.Get))
       {
			        <p>
                        <input type="hidden" name="prodId" value="@prodId"/>
                        <input type="submit" value="Chi tiết" />    
                    </p>
       }
                @using (Html.BeginForm("AddToCart", "Cart"))
                {
                    <input type="hidden" name="productId" value="@p.Prod.PRODUCT_ID"/>
                    <label>Số lượng</label>
                    <input type="text" name="quantity" value="1" style="width: 92px"/>
                    <input type="submit" value="Mua Hàng" />
                }
            </div>
	    </div>
    }
 </div>
